<?php
include_once("./_common.php");

$response = array();

if ($reg_id != "" && $pnum != "")
{
	$sql = "INSERT INTO gcm_table
	        (reg_id, phone_num)
	        VALUES
			('$reg_id', '$pnum')";
	$rst = sql_query($sql);

    if ($rst)
	{
        // successfully inserted into database
        $response["success"] = 1;
        $response["message"] = "Product successfully created.";
    }
	else
	{
        // failed to insert row
        $response["fail"] = 0;
        $response["message"] = "Oops! An error occurred.";
    }
}
else
{
    // required field is missing
    $response["fail"] = 0;
    $response["message"] = "Required field(s) is missing";    
}

echo json_encode($response);
?>